"""
历史记录接口模块
"""

from flask import Blueprint, request, jsonify
from datetime import datetime

bp = Blueprint('history', __name__, url_prefix='/api')

@bp.route('/history', methods=['GET'])
def get_history():
    """
    获取历史记录接口
    """
    try:
        page = request.args.get('page', 1, type=int)
        limit = request.args.get('limit', 20, type=int)
        
        response = {
            "success": True,
            "data": {
                "tasks": [],
                "total": 0,
                "page": page,
                "limit": limit,
                "has_next": False
            },
            "timestamp": datetime.utcnow().isoformat()
        }
        
        return jsonify(response)
        
    except Exception as e:
        return jsonify({
            "success": False,
            "message": "获取历史记录失败",
            "error_code": "HISTORY_ERROR",
            "details": str(e),
            "timestamp": datetime.utcnow().isoformat()
        }), 500